package com.owen.pojo;


public class Resp<E> {

    // 错误编码
    private String code;

    // 信息提示
    private String message;

    // 传入的类型
    private E body;


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public E getBody() {
        return body;
    }

    public void setBody(E body) {
        this.body = body;
    }

    public Resp(String code, String message, E body) {
        this.code = code;
        this.message = message;
        this.body = body;
    }

    public Resp() {
    }

    // 成功的方法
    public static <E> Resp<E> success(E body){
        return new Resp("200","",body);
    }

    // 失败的方法
    public static <E> Resp<E> fail(String code,String message){
        return new Resp(code,message,(Object)null);
    }

}